number = int(input()) # 整数个数
int_list = list(map(int,input().split()))
if number == len(int_list):
    max_number = max(int_list)
    min_number = min(int_list)
    range = max_number - min_number
    print(range)
else:
    print("第二行输入整数的个数不等于第一行的值")